#include<iostream>
#include<unordered_map>
#include<vector>
using namespace std;
int longestConsecutive(vector<int>& nums) {
    unordered_map<int, int> a;
    int m = 0;
    for (auto x : nums) {
        a[x] = 1;
    }
    cout<<endl;
    for (auto x : nums) {
        if (a[x - 1]!=1&&a[x]==1) {
            int i = 1;
            cout<<x<<"   "<<a[x]<<endl;
            while (a[x + i] == 1) {
                a[x]++;
                i++;
                cout<<x<<' '<<a[x]<<endl;
            }
            if (m < a[x])
                m = a[x];
        }
    }
    cout << m;
    return m;
}
int main(){
    vector<int>a={0,3,7,2,5,8,4,6,0,1};
    longestConsecutive(a);
}